<template>
  <div>
    <h1>这里是首页内容！</h1>
    <router-link to="/home/news">新闻</router-link>
    <router-link to="/home/message">消息</router-link>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      path: '/home/news'
    }
  },
  // created() {
  //   console.log('这里是created函数的调用现场！')
  // },
  // destroyed() {
  //   console.log('这里是destroyed函数的调用现场！')
  // }
  activated() {
    this.$router.push(this.path);
  },
  // deactivated() {
  //   console.log('这里是deactivated的调用现场！')
  // }
  beforeRouteLeave(to, from, next) {
    this.path = this.$route.path;
    next();
  }
}
</script>

<style scoped>

</style>
